Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MERGE for MySQL connector #24428

Merged
merged 2 commits into from
Jan 28, 2025
Merged

Conversation

chenjian2664
Copy link
Contributor

@chenjian2664 chenjian2664 commented Dec 10, 2024

Description

The tests that are updated in the BaseJdbcConnectorTest because current the implementation of MERGE for Mysql connector requires the table has primary keys, thus modified the table creation logic to use createTestTableForWrites, allowing the MySQL connector test class to override it and add primary keys as needed.

Release notes

## MySQL
* Add support for `MERGE` statement. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Dec 10, 2024
@chenjian2664 chenjian2664 force-pushed the mysql_merge branch 4 times, most recently from b4e8e08 to c0b86ce Compare December 10, 2024 12:42
@ebyhr
Copy link
Member

ebyhr commented Dec 10, 2024

current the implementation of MERGE for Mysql connector requires the table has primary keys

Is there a test verifying error message when executing MERGE statement on table without primary keys?

@chenjian2664 chenjian2664 force-pushed the mysql_merge branch 3 times, most recently from a4d84a0 to 3deed31 Compare December 16, 2024 09:06
@chenjian2664 chenjian2664 force-pushed the mysql_merge branch 2 times, most recently from 537b087 to 1146ad7 Compare December 19, 2024 07:52
Copy link

github-actions bot commented Jan 9, 2025

This pull request has gone a while without any activity. Tagging for triage help: @mosabua

@github-actions github-actions bot added the stale label Jan 9, 2025
@chenjian2664 chenjian2664 force-pushed the mysql_merge branch 2 times, most recently from d20d159 to 5b93e35 Compare January 15, 2025 09:51
@mosabua
Copy link
Member

mosabua commented Jan 15, 2025

Dont forget the docs update .. should be an easy one line include now ..

@mosabua
Copy link
Member

mosabua commented Jan 15, 2025

Thank you @chenjian2664

@findinpath findinpath requested a review from ebyhr January 16, 2025 08:58
@chenjian2664 chenjian2664 force-pushed the mysql_merge branch 2 times, most recently from 35191c2 to 527676b Compare January 20, 2025 03:12
@ebyhr
Copy link
Member

ebyhr commented Jan 24, 2025

Could you rebase on master to resolve conflicts?

@ebyhr
Copy link
Member

ebyhr commented Jan 24, 2025

Note that CI is failing due to JDK version up #24786

@chenjian2664
Copy link
Contributor Author

Oh, yes, just notice that, are we working on finding a new timezone?

if (matcher.matches()) {
String type = matcher.group(1).toLowerCase(Locale.ENGLISH);
if (type.contains("varchar") || type.contains("char")) {
// Mysql requires the primary keys must hava a fixed length, here use the 255 length that is just long enough for the test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the length is insufficient?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are exactly the same prefix(255) data and final in the case is try:

  • insert into target, then meet the Duplicate entry xx for ... error.
  • update/delete target, then test fails with wrong assert of update count and the expected data.

@ebyhr ebyhr merged commit a2c8717 into trinodb:master Jan 28, 2025
95 checks passed
@github-actions github-actions bot added this to the 470 milestone Jan 28, 2025
@chenjian2664 chenjian2664 deleted the mysql_merge branch January 28, 2025 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants